#ifndef _SORTER_H_
#define _SORTER_H_

#include <iostream>
#include <stdio.h>
#include <stdlib.h>

#include "Graph.h"

// Sorts an array of edges, using heap, merge or bubble sort, required by Kruskal's
class Sorter
{
	
public:
	enum SortType { heap, merge, bubble };
	Sorter(SortType type);
	Edge* sort(Edge *edgeArray, int size);// or Edge **sort(Edge **edgeArray, int size); if you prefer
	
private:
	void merge_arrs(Edge *B, int p, Edge *C, int q, Edge *A);
	void merge_sort(Edge *arr, int size);
	
	void bubble_sort(Edge *arr, int size);
	
	void heap_sort(Edge *arr, int count);
	void heapify(Edge *arr, int count);
	void sift_down(Edge *arr, int start, int end);
	
	SortType _sort_type;
};

#endif /** _SORTER_H_ **/

